<link href="/theme/Default/css/stalls/stallsAdd.css" rel="stylesheet">
<script src="/theme/Default/js/jquery.validate.js"></script>
<script src="/theme/Default/js/additional-methodsValidate.min.js"></script>
<script src="/theme/Default/js/StallsAdd/stallsAddValidate.js"></script>
<form action="<?php echo $action."/".$data['id']; ?>" method="post" id="stallsAdd" enctype="multipart/form-data">
	<input type="hidden" name="data[id]" value="<?php echo $data['id'];?>" id="shop_id"/>
	<div id="stalls-add">
		<div class="stalls_header">
			Chỉnh sửa nội dung gian hàng <span class="stalls_notice">(Vui lòng điền đầy đủ thông tin)</span>
		</div>
		<div class="stalls_row">
			<div class="stalls_label">
				Tên doanh nghiệp :
			</div>
			<div class="stalls_element">
				<div class="element-main">
					<input class="form-control" name="data[shop_name]" type="text" value="<?php echo $data['shop_name'];?>" id="data_shop_name" maxlength="60"/>
				</div>
				<div class="category_group_warntip hide">
					<div class="warntip_triangle">&nbsp;</div>
					<div class="warntip_content">
						<span>Hãy nhập tên doanh nghiệp</span>
			    	</div>
				</div>
			</div>
		</div>
		
		<div class="stalls_row">
			<div class="stalls_label">
				Chuyên mục :
			</div>
			<div class="stalls_element">
				<div class="element-main">
					<select class="form-control" data-size="8" name="data[category_id]" id="data_category_id">
						<option value="0">Chọn danh mục chính</option>
					    <?php
						    foreach ($rootCategories as $item){?>
								<optgroup value="<?php echo $item['RootCategory']['id']?>_" label="<?php echo $item['RootCategory']['category_name']?>">
								<?php
								foreach ($item['Category'] as $cat){?>
									<option value="<?php echo $cat['category_id']?>" <?php echo $cat['category_id']== $data['category_id']?"selected":"";?>>
									<?php echo $cat['category_name']?></option>
								<?php	
								}?>
								</optgroup>
								<?php
						    }
						?>
				  	</select>
				</div>
				<div class="category_group_warntip hide">
					<div class="warntip_triangle">&nbsp;</div>
					<div class="warntip_content">
						<span>Bạn chưa chọn danh mục chính của shop</span>
			    	</div>
				</div>
			</div>
		</div>
		
		<div class="stalls_row">
			<div class="stalls_label">
				Địa chỉ :
			</div>
			<div class="stalls_element">
				<div class="element-main">
					<input class="form-control" name="data[address]" type="text" value="<?php echo $data['address'];?>" id="data_address" maxlength="60"/>
				</div>
				<div class="category_group_warntip hide"> <!-- thêm class hide để k hiển thị lúc đầu -->
					<div class="warntip_triangle">&nbsp;</div>
					<div class="warntip_content">
						<span>Hãy nhập địa chỉ</span>
			    	</div>
				</div>
			</div>
		</div>
		
		<div class="stalls_row">
			<div class="stalls_label">
				Di động / Phone :
			</div>
			<div class="stalls_element">
				<div class="element-main">
					<input class="form-control" name="data[phone_number]" type="text" value="<?php echo $data['phone_number'];?>" id="data_phone_number" maxlength="11"/>
				</div>
				<div class="category_group_warntip hide">
					<div class="warntip_triangle">&nbsp;</div>
					<div class="warntip_content">
						<span>Hãy nhập số điện thoại</span>
			    	</div>
				</div>
			</div>
		</div>
		<div class="stalls_row">
			<div class="stalls_label">
				Email liên hệ:
			</div>
			<div class="stalls_element">
				<div class="element-main">
					<input class="form-control" name="data[email]" type="text" value="<?php echo $data['email'];?>" id="data_email" maxlength="60"/>
				</div>
				<div class="category_group_warntip hide">
					<div class="warntip_triangle">&nbsp;</div>
					<div class="warntip_content">
						<span>Hãy nhập Email</span>
			    	</div>
				</div>
			</div>
		</div>
		<div class="stalls_row">
			<div class="stalls_label">
				Website :
			</div>
			<div class="stalls_element">
				<div class="element-main">
					<input class="form-control" name="data[website]" type="text" value="<?php echo $data['website'];?>" id="data_website" maxlength="60"/>
				</div>
				<div class="category_group_warntip hide">
					<div class="warntip_triangle">&nbsp;</div>
					<div class="warntip_content">
						<span>Hãy nhập website</span>
			    	</div>
				</div>
			</div>
		</div>

		<div class="stalls_row">
			<div class="stalls_label">
				Banner (680x190) :
			</div>
			<div class="stalls_element">
				<div class="element-main">
					<input class="form-control" name="data[banner_image]" type="file" id="data_banner_image"/>
					<input type="hidden" name="data[banner_image_old]" value="<?php echo $data['banner_image'];?>" />
				</div>
				<div class="category_group_warntip hide">
					<div class="warntip_triangle">&nbsp;</div>
					<div class="warntip_content">
						<span>Hãy chọn banner</span>
			    	</div>
				</div>
			</div>
		</div>
		
		<div class="stalls_row">
			<div class="stalls_label">
				Logo (285x100) :
			</div>
			<div class="stalls_element">
				<div class="element-main">
					<input class="form-control" name="data[logo_image]" type="file" id="data_logo_image"/>
					<input type="hidden" name="data[logo_image_old]" value="<?php echo $data['logo_image'];?>" />
				</div>
				<div class="category_group_warntip hide">
					<div class="warntip_triangle">&nbsp;</div>
					<div class="warntip_content">
						<span>Hãy chọn logo</span>
			    	</div>
				</div>
			</div>
		</div>
		<!--update location -->
		<?php 
			$j = 0;
			$n = count($shopLocation);
		?>
		<?php for($j; $j<$n; $j++ ){?>
			<div class="location_info" style="width: 500px;">
			<div style="margin-left: 50px;">
			<a class="btn btn-success location lc<?php echo $j; ?>" href="javascript:void(0)">
				<span class="glyphicon glyphicon-minus-sign"></span>
			</a> 
					<?php echo $shopLocation[$j]['ShopLocation']['location']; ?>
			</div>
			<div class="stalls_row">
				<div class="stalls_label">
					Số điện thoại:
				</div>
				<div class="stalls_element">
					<div class="element-main">
						<input type="hidden" name="data[shopLocation][<?php echo $j; ?>][id]" value="<?php echo $shopLocation[$j]['ShopLocation']['id']; ?>"/>
						<input type="hidden" name="data[shopLocation][<?php echo $j; ?>][shop_id]" value="<?php echo $shopLocation[$j]['ShopLocation']['shop_id']; ?>"/>
						
						<input type="hidden" name="data[shopLocation][<?php echo $j; ?>][location]" value="<?php echo $shopLocation[$j]['ShopLocation']['location']; ?>"/>
						<input type="hidden" name="data[shopLocation][<?php echo $j; ?>][location_id]" value="<?php echo $shopLocation[$j]['ShopLocation']['location_id']; ?>"/>
						<input class="form-control"  value="<?php echo $shopLocation[$j]['ShopLocation']['phone']; ?>" type="text" name="data[shopLocation][<?php echo $j; ?>][phone]" placeholder="Số điện thoại" id="data_lc_phone<?php echo $j; ?>"/>
					</div>
					<div class="category_group_warntip hide">
						<div class="warntip_triangle">&nbsp;</div>
						<div class="warntip_content">
							<span>Hãy nhập số điện thoại</span>
				    	</div>
					</div>
				</div>
			</div>
			<div class="stalls_row">
				<div class="stalls_label">
					Tên người liên hệ:
				</div>
				<div class="stalls_element">
					<div class="element-main">
						<input class="form-control" value="<?php echo $shopLocation[$j]['ShopLocation']['name']; ?>" type="text" name="data[shopLocation][<?php echo $j; ?>][name]" placeholder="Tên người liên hệ" id="data_lc_name<?php echo $j; ?>"/>
					</div>
					<div class="category_group_warntip hide">
						<div class="warntip_triangle">&nbsp;</div>
						<div class="warntip_content">
							<span>Hãy nhập tên người liên hệ</span>
				    	</div>
					</div>
				</div>
			</div>
			<div class="stalls_row">
				<div class="stalls_label">
					 Số fax:
				</div>
				<div class="stalls_element">
					<div class="element-main">
						<input class="form-control"  value="<?php echo $shopLocation[$j]['ShopLocation']['fax']; ?>"  type="text" name="data[shopLocation][<?php echo $j; ?>][fax]" placeholder="Số fax" id="data_lc_fax<?php echo $j; ?>"/>
					</div>
					<div class="category_group_warntip hide">
						<div class="warntip_triangle">&nbsp;</div>
						<div class="warntip_content">
							<span>Hãy nhập số fax</span>
				    	</div>
					</div>
				</div>
			</div>
			
			<div class="stalls_row">
				<div class="stalls_label">
					 Địa chỉ email:
				</div>
				<div class="stalls_element">
					<div class="element-main">
						<input class="form-control" value="<?php echo $shopLocation[$j]['ShopLocation']['email']; ?>" type="text" name="data[shopLocation][<?php echo $j; ?>][email]" placeholder="Địa chỉ email" id="data_lc_email<?php echo $j; ?>"/>
					</div>
					<div class="category_group_warntip hide">
						<div class="warntip_triangle">&nbsp;</div>
						<div class="warntip_content">
							<span>Hãy nhập địa chỉ email</span>
				    	</div>
					</div>
				</div>
			</div>
			
			<div class="stalls_row">
				<div class="stalls_label">
					 Facebook:
				</div>
				<div class="stalls_element">
					<div class="element-main">
						<input class="form-control"  value="<?php echo $shopLocation[$j]['ShopLocation']['facebook']; ?>" type="text" name="data[shopLocation][<?php echo $j; ?>][facebook]" placeholder="facebook" id="data_lc_facebook<?php echo $j; ?>"/>
					</div>
					<div class="category_group_warntip hide">
						<div class="warntip_triangle">&nbsp;</div>
						<div class="warntip_content">
							<span>Hãy nhập facebook</span>
				    	</div>
					</div>
				</div>
			</div>
			
		</div>
		<?php } ?>
		<!--new -->
		<!-- location info -->
		<?php $arrLocation = array("Miền Nam", "Miền Trung", "Miền Bắc");
			$n = count($locationNew); 
		?>
		<?php for($i=0; $i<$n; $i++ ){?>
		<div class="location_info clicked" style="width: 500px;">
			<div style="margin-left: 50px;">
			<a class="btn btn-success location lc<?php echo $j; ?>" href="javascript:void(0)">
				<span class="glyphicon glyphicon-minus-sign"></span>
			</a> 
					<?php echo $arrLocation[$locationNew[$i]]; ?>
			</div>
			<div class="stalls_row hide">
				<div class="stalls_label">
					Số điện thoại:
				</div>
				<div class="stalls_element">
					<div class="element-main">
						<input type="hidden" name="data[shopLocation][<?php echo $j; ?>][location]" value="<?php echo $arrLocation[$locationNew[$i]]; ?>"/>
						<input type="hidden" name="data[shopLocation][<?php echo $j; ?>][location_id]" value="<?php echo $locationNew[$i]; ?>"/>
						<input class="form-control" type="text" name="data[shopLocation][<?php echo $j; ?>][phone]" placeholder="Số điện thoại" id="data_lc_phone<?php echo $j; ?>"/>
					</div>
					<div class="category_group_warntip hide">
						<div class="warntip_triangle">&nbsp;</div>
						<div class="warntip_content">
							<span>Hãy nhập số điện thoại</span>
				    	</div>
					</div>
				</div>
			</div>
			<div class="stalls_row hide">
				<div class="stalls_label">
					Tên người liên hệ:
				</div>
				<div class="stalls_element">
					<div class="element-main">
						<input class="form-control" type="text" name="data[shopLocation][<?php echo $j; ?>][name]" placeholder="Tên người liên hệ" id="data_lc_name<?php echo $j; ?>"/>
					</div>
					<div class="category_group_warntip hide">
						<div class="warntip_triangle">&nbsp;</div>
						<div class="warntip_content">
							<span>Hãy nhập tên người liên hệ</span>
				    	</div>
					</div>
				</div>
			</div>
			<div class="stalls_row hide">
				<div class="stalls_label">
					 Số fax:
				</div>
				<div class="stalls_element">
					<div class="element-main">
						<input class="form-control" type="text" name="data[shopLocation][<?php echo $j; ?>][fax]" placeholder="Số fax" id="data_lc_fax<?php echo $j; ?>"/>
					</div>
					<div class="category_group_warntip hide">
						<div class="warntip_triangle">&nbsp;</div>
						<div class="warntip_content">
							<span>Hãy nhập số fax</span>
				    	</div>
					</div>
				</div>
			</div>
			
			<div class="stalls_row hide">
				<div class="stalls_label">
					 Địa chỉ email:
				</div>
				<div class="stalls_element">
					<div class="element-main">
						<input class="form-control" type="text" name="data[shopLocation][<?php echo $j; ?>][email]" placeholder="Địa chỉ email" id="data_lc_email<?php echo $j; ?>"/>
					</div>
					<div class="category_group_warntip hide">
						<div class="warntip_triangle">&nbsp;</div>
						<div class="warntip_content">
							<span>Hãy nhập địa chỉ email</span>
				    	</div>
					</div>
				</div>
			</div>
			
			<div class="stalls_row hide">
				<div class="stalls_label">
					 Facebook:
				</div>
				<div class="stalls_element">
					<div class="element-main">
						<input class="form-control" type="text" name="data[shopLocation][<?php echo $j; ?>][facebook]" placeholder="facebook" id="data_lc_facebook<?php echo $j; ?>"/>
					</div>
					<div class="category_group_warntip hide">
						<div class="warntip_triangle">&nbsp;</div>
						<div class="warntip_content">
							<span>Hãy nhập facebook</span>
				    	</div>
					</div>
				</div>
			</div>
			
		</div>
		<?php $j++; } ?>
		<!-- end location info -->
		<!-- end new -->
		<div class="stalls_row">
			<div class="stalls_label">
				
			</div>
			<div class="stalls_element">
				<div class="element-main">
					<button type="submit" class="btn btn-danger">Sửa Gian Hàng</button>
				</div>
			</div>
		</div>
	</div>
</form>